/**
 * @version $Id: thumbs.js 17 2011-11-21 14:48:48Z nhnoah $
 */
var images_paths = [];
var thumb_counter = 0;

function display_thumbs() {
	more_thumbs = true;
	
	while(more_thumbs){
		thumb = document.getElementById('img_thumb_'+thumb_counter);
		if(document.getElementById('img_thumb_'+thumb_counter) != null){
			images_paths.push(thumb.getAttribute('link_att'));
			get_thumb(thumb_counter);
			thumb_counter++;
		}
		else
			more_thumbs = false;
	}
}

function get_thumb(id) 
{
	var xhr;
	try	{ xhr = new XMLHttpRequest();}
	catch(e)
	{
		try
		{
			xhr = new ActiveXObject("Msxml12.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4)
		{
			document.getElementById('img_thumb_'+id).setAttribute('src', 'matrix-sys/thumb_gen.php?image_path='+document.getElementById('img_thumb_'+id).getAttribute('link_att'));
		}
	}
	xhr.open("GET", "matrix-sys/thumb_gen.php?image_path="+images_paths[id], true);
	xhr.send(null);
}
